"""
    Main module of GameServer.
    Package gameserver
    Project PyBaldaJ
    Provides:
        start() - starts the server
        theServer - Server object
        GameServer - Server class
"""

import socketserver     #       system module provides socket server framework
from gameserver.game import balda      #       provide game interface
from gameserver import protocol  #       protocol processor
#from gameserver import players   #       players colletcion class
class GameServer(socketserver.TCPServer):
    """
        GameServer main class

    __game              game object
    __palyers           players collection

    """

    def __init__(self, *arguments):
        self.__game = balda.Game(0)
#        self.__players = players.PalyersCollection()
        socketserver.TCPServer.__init__(self, *arguments)


theServer = GameServer(("localhost", 11111), protocol.StreamProtocolHandler)

def start():
    theServer.serve_forever()

def stop():
    theServer.shutdown()
    


